const path = require('path');
const { exec } = require('child_process');

const dist = path.join(__dirname);
const ossCwd = '/Users/chen/Documents/workspace/ossutil';
cmd = `./ossutilmac64 cp ${dist} oss://chenjingjie/ecs --exclude deploy.js -r -f -c .ossutilconfig`

exec(
  cmd,
  { cwd: ossCwd },
  (error, stdout, stderr) => {
    if (error) {
      console.error(`执行出错: ${error}`);
      return;
    }
    if (stdout) {
      console.log(`stdout: ${stdout}`);
    }
    if (stderr) {
      console.log(`stderr: ${stderr}`);
    }
  }
)


// const offsetPath = paths.filter(i => {
//   return i !== 'index.html';
// })
  // console.log(offsetPath);
// const cmd = `cp -rf ${offsetPath.join(' ')} ../koa-graphql/src/static/hadoop`
// console.log(cmd)
// exec(cmd, (err) => {
//   if (err) {
//     console.log(err)
//   }
//   console.log('end');
// })